package com.jgp.config;

import org.hibernate.boot.model.naming.Identifier;
import org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl;
import org.hibernate.engine.jdbc.env.spi.JdbcEnvironment;

/**
 * 项目   sys
 * 作者   loufei
 * 时间   2018/2/25
 */
public class MysqlUpperCaseStrategy extends PhysicalNamingStrategyStandardImpl {
    
    @Override
    public Identifier toPhysicalCatalogName(Identifier name, JdbcEnvironment context) {
        return Identifier.toIdentifier("`"+context.getCurrentCatalog().getText()+"`");
    }
    
    @Override
    public Identifier toPhysicalTableName(Identifier name, JdbcEnvironment context) {
        String tableName = name.getText();
        return Identifier.toIdentifier("`"+tableName+"`");
    }
    
    @Override
    public Identifier toPhysicalColumnName(Identifier name, JdbcEnvironment context) {
        String columnName = name.getText();
        return Identifier.toIdentifier("`"+columnName+"`");
    }
    
    
}
